#include "logdialog.h"
#include "ui_logdialog.h"

#include "mainwindow.h"




LogDialog::LogDialog(void* mainWindow,QWidget* parent):QDialog(parent),ui(new Ui::LogDialog){
  ui->setupUi(this);

  this->mainWindow=mainWindow;
  IsInit=false;



  IsInit=true;
}

LogDialog::~LogDialog(){
  delete ui;
}

void LogDialog::AddLog(QString& Text){
  ui->textBrowser_Log->append(Text);
}

void LogDialog::AddLog(QString&& Text){
  ui->textBrowser_Log->append(Text);
}




void LogDialog::closeEvent(QCloseEvent* event){

  Q_UNUSED(event);


  ((MainWindow*)mainWindow)->LogDialogCloseEvent();
}




void LogDialog::on_pushButton_Clear_clicked(){
  ui->textBrowser_Log->clear();
}

void LogDialog::on_textBrowser_Log_textChanged(){
  ui->textBrowser_Log->moveCursor(QTextCursor::MoveOperation::End);
}



